package com.lut.edu.apm.payCenter.services.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lut.edu.apm.payCenter.dao.OrderDetailMapper;
import com.lut.edu.apm.payCenter.pojo.OrderDetail;
import com.lut.edu.apm.payCenter.services.OrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author Zhao Suzhen
 * @date `2024/5/22`
 */
@Service
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService {

    @Autowired
    OrderDetailMapper orderDetailMapper;

    @Override
    public List<Map<String, Object>> queryHotSelling() {
        return orderDetailMapper.selectHotSelling();
    }

    @Override
    public List<Map<String, Object>> queryTypeCount() {
        return orderDetailMapper.selectTypeCount();
    }

    @Override
    public List<OrderDetail> queryOrderDetail(String orderId) {
        QueryWrapper<OrderDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("order_no", orderId);
        return orderDetailMapper.selectList(queryWrapper);
    }
}
